/*
 * utils.h
 *
 *  Created on: Dec 13, 2011
 *      Author: piotrek
 */

#ifndef UTILS_H_
#define UTILS_H_

#include <pthread.h>
#include <fcntl.h>
#include "common.h"
#include "logger.h"

void log_thread_info(const char *msg, pthread_t id);
void append_monitor_thread(struct monitor_thread *thread);
void remove_monitor_thread(struct monitor_thread *thread);
struct monitor_thread *get_monitor_thread(pthread_t thread_id);
char* execute_script(const char *script_name, const char* target_fname,
		struct monitor_thread* mthread, size_t *);
void send_single_data(int queue_id, struct monitor_response *response,
		size_t size, int msgflg, enum thread_status *status, pthread_t thread_id);
void send_data(int queue_id, int msg_id, pthread_t thread_id, const char * data, size_t data_size);

void terminate_thread(pthread_t, int);

// dla procesu
void fill_with_mmaps_lib_num(struct monitor_thread* mthread, char **buff, size_t *buff_pos);
void fill_with_strace_mmaps(struct monitor_thread* mthread, char **buff, size_t *buff_pos);
void fill_with_header(struct monitor_thread* mthread, char **buff, size_t *buff_pos);
void fill_with_statm_info(struct monitor_thread* mthread, char **buff, size_t *buff_pos);
void fill_with_stat_info(struct monitor_thread* mthread, char **buff, size_t *buff_pos);

#endif /* UTILS_H_ */
